package sel.me.popular.library.learning.mapstruct;

/**
 * @author shenenlu 2021年02月20日 下午14:12:47
 */
public enum PersonAgeEnum {

    FIFTEEN(15, "十五")

    ;


    private final int age;

    private final String desc;

    public int getAge() {
        return age;
    }

    public String getDesc() {
        return desc;
    }

    PersonAgeEnum(int age, String desc) {
        this.age = age;
        this.desc = desc;
    }


    public static PersonAgeEnum get(int age){
        for(PersonAgeEnum personAgeEnum : PersonAgeEnum.values()){
            if( personAgeEnum.age == age ){
                return personAgeEnum;
            }
        }

        throw new IllegalArgumentException("wrong PersonAgeEnum, age: "+ age);
    }

}
